package demo1.demo1.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Component
@Validated
//javaConfig绑定配置文件的值,可以采取这些方式
@ConfigurationProperties( prefix = "cat" ) //yaml配置产生提示
//@PropertySource(value = "classpath:cat.properties")
public class Cat {

    //    SPEL表达式取出配置文件的值
//    @Email(message = "邮箱格式错误")
    private String name;
//    @Max(value=200,message="最大不超过200")
    private String age;
    @NotNull(message="生日不能为空")
    private Date birth;
    private Boolean fly;
    private Map<String,Object> maps;
    private List<Object> lists;
    private Door door;

}


